package lore.miniwechat.service.impl;

import lore.miniwechat.entity.Friend;
import lore.miniwechat.mapper.FriendMapper;
import lore.miniwechat.service.FriendsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FriendsServiceImpl implements FriendsService {

    @Autowired
    FriendMapper mapper;

    @Override
    public void insert(Friend friend) {
        mapper.insertSelective(friend);
    }

    @Override
    public List<Friend> getFriends() {
        return mapper.selectByExample(null);
    }

    @Override
    public void updateRemark(String uid,String id) {
        Friend friend = mapper.selectByPrimaryKey(uid, id);
        mapper.updateByPrimaryKey(friend);
    }

    @Override
    public void deleteFriend(String uid,String id) {
        mapper.deleteByPrimaryKey(uid,id);
    }
}
